//
//  CommentViews.m
//  TodatPlay
//
//  Created by dllo on 16/9/5.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "CommentViews.h"
#import "SDAutoLayout.h"
#import "UIView+Frame.h"
@interface CommentViews ()
@property (nonatomic, strong) UIImageView *likeImageView;
@property (nonatomic, strong) UIImageView *commentImageView;
@property (nonatomic, strong) UIView *grayView;
@property (nonatomic, strong) UIImageView *heartImageView;
@property (nonatomic, strong) UILabel *praiseLabel;
@property (nonatomic, strong) UIView *likeLineView;

@end



@implementation CommentViews
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createComment];
    
    }
    return self;
}
- (void)createComment {
    // 床建竖条View
    UIView *viewOfline = [UIView new];
    viewOfline.backgroundColor = [UIColor colorWithWhite:0.902 alpha:1.000];
    [self addSubview:viewOfline];
    
    self.likeImageView = [UIImageView new];
    self.commentImageView = [UIImageView new];
    self.numberLikeLabel = [UILabel new];
    self.numberCommentLabel = [UILabel new];
    self.grayView = [UIView new];
    self.grayView.backgroundColor = [UIColor colorWithWhite:0.965 alpha:1.000];
    [self addSubview:_likeImageView];
    [self addSubview:_commentImageView];
    [self addSubview:_numberLikeLabel];
    [self addSubview:_numberCommentLabel];
    [self addSubview:_grayView];
    self.numberCommentLabel.font = [UIFont systemFontOfSize:13];
    self.numberLikeLabel.font = [UIFont systemFontOfSize:13];
    self.numberLikeLabel.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    self.numberCommentLabel.textColor = [UIColor colorWithWhite:0.702 alpha:1.000];
    self.likeImageView.image = [UIImage imageNamed:@"Indexnew_love"];
    self.commentImageView.image = [UIImage imageNamed:@"index_jilu_more"];
    
    self.heartImageView = [UIImageView new];
    self.likeUserNameLabel = [UILabel new];
    self.praiseLabel = [UILabel new];
    self.likeLineView = [UIView new];
    self.commentUserNameLabel = [UILabel new];
    self.commentLabel = [UILabel new];
    
    [_grayView addSubview:_heartImageView];
    [_grayView addSubview:_likeUserNameLabel];
    [_grayView addSubview:_praiseLabel];
    [_grayView addSubview:_likeLineView];
    [_grayView addSubview:_commentUserNameLabel];
    [_grayView addSubview:_commentLabel];
    
    self.numberCommentLabel.sd_layout
    .rightSpaceToView(self, 10)
    .topSpaceToView(self, 5)
    .heightIs(30)
    .widthIs(10);
    self.numberCommentLabel.text = @"0";
    self.numberLikeLabel.text = @"0";
    self.commentImageView.sd_layout
    .centerYEqualToView(self.numberCommentLabel)
    .rightSpaceToView(self.numberCommentLabel, 2)
    .widthIs(25)
    .heightIs(15);
    
    viewOfline.sd_layout
    .widthIs(1)
    .heightIs(15)
    .centerYEqualToView(self.commentImageView)
    .rightSpaceToView(self.commentImageView, 6);
    
    self.numberLikeLabel.sd_layout
    .heightIs(30)
    .widthIs(10)
    .rightSpaceToView(viewOfline, 6)
    .centerYEqualToView(viewOfline);
    
    self.likeImageView.sd_layout
    .widthIs(30)
    .heightIs(25)
    .rightSpaceToView(self.numberLikeLabel, 2)
    .centerYEqualToView(self.numberLikeLabel).offset(3);
    
    // 设置灰色背景里面的内容
        self.grayView.sd_layout
        .leftSpaceToView(self, 5)
        .rightSpaceToView(self, 5)
        .topSpaceToView(self.numberCommentLabel, 5)
        .heightIs(100);
    
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
